package cn.ryh.environmentvariable.entity;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 使用了ConfigurationProperties注解则可以不用单独使用@Value注解，只需变量名和配置中一一对应即可（根据驼峰规则）
 * @ClassName Configuration
 * @Description 用于读取resources根目录下的application.properties或application.yml的配置信息
 * @Author RaoYH
 */
@Component
@ConfigurationProperties(prefix = "spring.datasource")
public class ApplicationConfig {
   // @Value("${spring.datasource.username}")
    private String username;
   // @Value("${spring.datasource.url}")
    private String url;
   // @Value("${spring.datasource.password}")
    private String password;
   // @Value("${spring.datasource.driver-class-name}")
    private String driverClassName;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDriverClassName() {
        return driverClassName;
    }

    public void setDriverClassName(String driverClassName) {
        this.driverClassName = driverClassName;
    }
}
